﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace BetterXml
{
    class Program
    {
        static void Main(string[] args)
        {
            ExpatWrapper expat = new ExpatWrapper();

            if (args.Length == 0)
            {
                string file = Path.GetTempFileName();
                using (StreamWriter sw = new StreamWriter(file))
                {
                    sw.Write(Console.In.ReadToEnd());
                }
                expat.Parse(file);
                try
                {
                    File.Delete(file);
                }
                catch
                {
                }
            }
            else if (File.Exists(args[0]))
            {
                expat.Parse(args[0]);
            }
            else
            {
                Console.WriteLine("Usage: BetterXml [FileName]");
            }

           
#if DEBUG
            Console.ReadKey();
#endif

        }
    }
}
